home *** CD-ROM | disk | FTP | other *** search
Wrap
from PSPApp import * # Copyright 2006 Corel Software Inc., all rights reserved # This file contains utility routines provided by Corel Software. # This file contains all translatable strings for the bundled script files. ScriptData = {} class SaveSelection: ''' define a helper class that can save any active selection to the alpha channel and restore it later ''' def __init__( self, Environment, Doc ): ''' at init time we save the environment variable provided by PSP, and if a selection exists we save it to an alpha channel ''' self.Env = Environment self.SavedSelection = '__$TempSavedSelection$__' self.IsSaved = 0 self.SavedOnDoc = Doc SelResult = App.Do( self.Env, 'GetRasterSelectionRect' ) if SelResult[ 'Type' ] != App.Constants.SelectionType.None: # if there is a selection save it to the alpha channel App.Do( self.Env, 'SelectSaveDisk', { 'FileName': self.SavedSelection, 'Overwrite': App.Constants.Boolean.true, 'GeneralSettings': { 'ExecutionMode': App.Constants.ExecutionMode.Silent, 'AutoActionMode': App.Constants.AutoActionMode.Match } }, Doc) self.IsSaved = 1 # set this so we know we saved one if SelResult[ 'Type' ] == App.Constants.SelectionType.Floating: # if the selection is floating promote it to a layer App.Do( self.Env, 'SelectPromote', { 'KeepSelection': App.Constants.Boolean.false, 'LayerName': SelectionLayer, 'GeneralSettings': { 'ExecutionMode': App.Constants.ExecutionMode.Silent, 'AutoActionMode': App.Constants.AutoActionMode.Match } }, Doc) else: App.Do( self.Env, 'SelectNone' ) def RestoreSelection( self ): ''' if we have saved a selection, restore it now. If we promoted a floating selection to a layer we don't restore the selection but don't attempt to mess with the layer in any way ''' if self.IsSaved == 1: # load the selection back from disk - this will replace any existing selection App.Do( self.Env, 'SelectLoadDisk', { 'FileName': self.SavedSelection, 'Operation': App.Constants.SelectionOperation.Replace, 'UpperLeft': App.Constants.Boolean.false, 'ClipToCanvas': App.Constants.Boolean.false, 'GreyMethod': App.Constants.CreateMaskFrom.Luminance, 'Invert': App.Constants.Boolean.false, 'GeneralSettings': { 'ExecutionMode': App.Constants.ExecutionMode.Silent, 'AutoActionMode': App.Constants.AutoActionMode.Match } }, self.SavedOnDoc) # end class SaveSelection def NameFromMaterial( Material, Delimiter=' ', IncludeTexture=1 ): ''' Given a material repository, return a name that describes it. By default the name is delimited with space, but the delimiter parameter can be used to override it. By default textures are included in the name, but can be omitted by setting the IncludeTexture parameter to 0 ''' TextureName = None TypeName = '' if Material is None: CoreName = Null else: if Material[ 'Pattern' ] and \ (Material[ 'Pattern' ][ 'Name' ] or Material[ 'Pattern' ][ 'Image' ] ): TypeName = Pattern if Material[ 'Pattern' ][ 'Name' ]: CoreName = Material[ 'Pattern' ][ 'Name' ] else: CoreName = Inline elif Material[ 'Gradient' ] and Material[ 'Gradient' ][ 'Name' ]: TypeName = Gradient GradType = {} GradType[ App.Constants.GradientType.Linear ] = Linear GradType[ App.Constants.GradientType.Rectangular ] = Rectangular GradType[ App.Constants.GradientType.Radial ] = Radial GradType[ App.Constants.GradientType.Angular ] = Sunburst CoreName = '%s%s%s' % ( Material[ 'Gradient' ][ 'Name' ], Delimiter, GradType[ Material[ 'Gradient' ][ 'GradientType' ] ] ) elif Material[ 'Art' ]: TypeName = Art CoreName = '%02x%02x%02x' % Material[ 'Art' ][ 'Color' ] else: TypeName = Solid CoreName = '%02x%02x%02x' % Material[ 'Color' ] if Material[ 'Texture' ] and Material[ 'Texture' ][ 'Name' ]: TextureName = Material[ 'Texture' ]['Name'] if TextureName is not None and IncludeTexture != 0: MaterialName = '%s%s%s%s%s' % ( TypeName, Delimiter, CoreName, Delimiter, TextureName ) else: MaterialName = '%s%s%s' % ( TypeName, Delimiter, CoreName ) return MaterialName def IsNullMaterial( Material ): ' check if the passed in material is none. Returns true if null, false if non-null' if Material is None: return App.Constants.Boolean.true # material might be entirely none ArtIsNone = 0 ColorIsNone = 0 GradientIsNone = 0 PatternIsNone = 0 if Material['Color'] is None: ColorIsNone = 1 if Material['Gradient'] is None or Material['Gradient']['Name'] is None: GradientIsNone = 1 if Material['Pattern'] is None or \ (Material['Pattern']['Name'] is None and Material['Pattern']['Image'] is None): PatternIsNone = 1 if Material['Art'] is None: ArtIsNone = 1 if ColorIsNone and GradientIsNone and PatternIsNone and ArtIsNone: return App.Constants.Boolean.true #it works out to none else: return App.Constants.Boolean.false def IsFlatImage( Environment, Doc ): 'Determine if Doc consists of a single background layer. True if flat, false if not' ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc ) LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc ) if ImageInfo[ 'LayerNum' ] == 1 and LayerInfo[ 'IsBackground' ] == App.Constants.Boolean.true: return App.Constants.Boolean.true else: return App.Constants.Boolean.false def IsPaletted( Environment, Doc ): '''Determine if the current image is paletted. Greyscale is not counted as paletted Returns true on paletted, false if not ''' # these are all the paletted pixel formats TargetFormats = [ App.Constants.PixelFormat.Index1, App.Constants.PixelFormat.Index4, App.Constants.PixelFormat.Index8 ] # are we paletted? Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc ) if Info['PixelFormat'] in TargetFormats: return App.Constants.Boolean.true else: return App.Constants.Boolean.false def IsTrueColor( Environment, Doc ): ''' Determine if the current image is true color. Greyscale does not count Returns true for true color, false for all others ''' TargetFormats = [ App.Constants.PixelFormat.BGR, App.Constants.PixelFormat.BGRA ] # are we true color? Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc ) if Info['PixelFormat'] in TargetFormats: return App.Constants.Boolean.true else: return App.Constants.Boolean.false def IsGreyScale( Environment, Doc ): ' Determine if the current image (not layer) is greyscale. True if it is, false otherwise' TargetFormats = [ App.Constants.PixelFormat.Grey, App.Constants.PixelFormat.GreyA ] # are we true color? Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc ) if Info['PixelFormat'] in TargetFormats: return App.Constants.Boolean.true else: return App.Constants.Boolean.false def LayerIsArtMedia( Environment, Doc ): 'Returns true if the current layer is a artmedia layer' LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc ) if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.ArtMedia: return App.Constants.Boolean.true else: return App.Constants.Boolean.false def LayerIsRaster( Environment, Doc ): 'Returns true if the current layer is a raster layer' LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc ) if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Raster: return App.Constants.Boolean.true else: return App.Constants.Boolean.false def LayerIsVector( Environment, Doc ): 'Returns true if the current layer is a vector layer' LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc ) if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Vector: return App.Constants.Boolean.true else: return App.Constants.Boolean.false def LayerIsBackground( Environment, Doc ): 'Returns true if the current layer is the background layer' LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc ) return LayerInfo[ 'IsBackground' ] def GetLayerCount( Environment, Doc ): 'Returns number of layers in Doc' ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc ) return ImageInfo[ 'LayerNum' ] def GetCurrentLayerName( Environment, Doc ): 'Returns the name of the current layer in Doc' LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc ) return LayerInfo[ 'General' ][ 'Name' ] def PromoteToTrueColor( Environment, Doc ): 'If the current image type is paletted, promote it to true color. Greyscale is left alone' if IsPaletted( Environment, Doc ): App.Do( Environment, 'IncreaseColorsTo16Million', {}, Doc ) return def RequireADoc( Environment ): '''Test that we actually have a target document, and put up a message box if we dont Returns true if we have an open doc, false otherwise ''' if App.TargetDocument is None: App.Do( Environment, 'MsgBox', { 'Buttons': App.Constants.MsgButtons.OK, 'Icon': App.Constants.MsgIcons.Stop, 'Text': RequiresOpenImage, }) return App.Constants.Boolean.false else: return App.Constants.Boolean.true # Begin Translatable Strings # BevelSelection.PspScript: LayerName_BevelSelection = u"Afgeschuinde selectie" # Black and white pencil.PspScript: LayerName_Blackandwhitepencil = u"Raster 2" # Border with drop shadow.PspScript: AlphaName = u"Selection #1" # Flag.PspScript: #AlphaName = u"Selection #1" # Grey chart.PspScript: GradientName = u"Voorgrond-achtergrond" # Sloppy edges.PspScript: #AlphaName = u"Selection #1" # Toned greyscale.PspScript: LayerName_Tonedgreyscale = u"Kleurbalans 1" # Vignette.PspScript: LayerName_Vignette = u"Raster 2" # Photo edges.PspScript: LayerName_Photoedges = u"Raster 2" # SimpleCaption.PspScript: ImageTooSmallMsg = u"De huidige afbeelding is te klein voor een bijschrift - afbeelding moet minstens 200x200 zijn." MultipleLayersMsg = u"De huidige afbeelding heeft meerdere lagen. Dit kan vreemde resultaten opleveren.\nWe raden u aan de afbeelding samen te voegen alvorens verder te gaan. Wilt u samenvoegen?" CaptionPrompt = u"Voer een bijschrift in voor de afbeelding. Deze wordt onder de afbeelding gecentreerd." CaptionTitle = u"Voer afbeeldingsbijschrift in" PromotedLayerName = u"Afbeelding" PageSurfaceLayerName = u"Paginaoppervlak" AlbumPageLayerGroup = u"Albumpagina" DropShadowLayerName = u"Slagschaduw" CaptionTextLayerName = u"Tekst bijschrift" CaptionFontName2 = u"Tahoma" # VectorMergeAndCutoutSelected.PspScript: TwoOrMoreMsg = u"Voor dit script moet u twee of meer vectorobjecten selecteren." # VectorMergeSelected.PspScript: #TwoOrMoreMsg = u"This script requires that two or more vector objects be selected." # AddPSP8FileLocations.PspScript: NoPSP8FoldersFound = u"Geen PSP8-mappen gevonden." FilesHaveBeenAdded = u"De bestanden in '%s' zijn toegevoegd aan de voorkeuren voor bestandslocaties." Brushes = u"Penselen" BumpMaps = u"Bump-toewijzingen" DeformationMaps = u"Vervormingstoewijzingen" DisplacementMaps = u"Verplaatsingstoewijzingen" EnvironmentMaps = u"Omgevingstoewijzingen" Gradients = u"Verlopen" Masks = u"Maskers" Palettes = u"Paletten" Patterns = u"Patronen" PictureFrames = u"Fotolijsten" PictureTubes = u"Plaatjespenselen" PresetShapes = u"Basisvormen" Presets = u"Voorinstellingen" PrintTemplates = u"Afdruksjablonen" QuickGuides = u"Handleidingen" SampleImages = u"Voorbeeldafbeeldingen" ScriptsRestricted = u"Scripts - Beperkt" ScriptsTrusted = u"Scripts - Vertrouwd" Selections = u"Selecties" StyledLines = u"Aangepaste lijnstijlen" Swatches = u"Stalen" Textures = u"Texturen" # AddPSP8FileLocationsALL.PspScript: #NoPSP8FoldersFound = u"No PSP8 folders found." #FilesHaveBeenAdded = u"Files in '%s' have been added to the File Locations preferences." #Brushes = u"Brushes" #BumpMaps = u"Bump Maps" #DeformationMaps = u"Deformation Maps" #DisplacementMaps = u"Displacement Maps" #EnvironmentMaps = u"Environment Maps" #Gradients = u"Gradients" #Masks = u"Masks" #Palettes = u"Palettes" #Patterns = u"Patterns" #PictureFrames = u"Picture Frames" #PictureTubes = u"Picture Tubes" #PresetShapes = u"Preset Shapes" #Presets = u"Presets" #PrintTemplates = u"Print Templates" #QuickGuides = u"Quick Guides" #SampleImages = u"Sample Images" #ScriptsRestricted = u"Scripts-Restricted" #ScriptsTrusted = u"Scripts-Trusted" #Selections = u"Selections" #StyledLines = u"Styled Lines" #Swatches = u"Swatches" #Textures = u"Textures" # CapturePalette.PspScript: RequiresPaletted = u"Dit script vereist een paletafbeelding. Wilt u de kleurdiepte reduceren?" NoPaletteFound = u"Interne fout: Geen palet gevonden" GroutWidthMsg = u"GroutWidth-waarde moet tussen 0 en 20 liggen" ColorsPerRowMsg = u"ColorsPerRow-waarde moet tussen 1 en 100 liggen" TileSizeMsg = u"TileSize moet tussen 2 en 50 liggen" NumColorsMsg = u"Aantal kleuren moet tussen 2 en 1024 liggen" ButtonMarginMsg = u"ButtonMargin moet kleiner zijn dan de helft van de tilesize" ColorIs = u"Kleur %d is (%02X,%02X,%02X)" # EXIFCaptioning.PspScript: NoEXIFData = u"Geen EXIF-gegevens gevonden in de huidige afbeelding." ExposureMsg = u"f/%g opening, %s belichting" CaptionBackground = u"Bijschrift Achtergrond" EXIFCaption = u"EXIF Bijschrift" EXIFText = u"EXIF Tekst" CaptionFontName = u"Arial" # SplitCMYKtoLayerGroup.PspScript: Black = u"Zwart" BlackChannel = u"Zwart kanaal" Yellow = u"Geel" YellowChannel = u"Geel kanaal" Magenta = u"Magenta" MagentaChannel = u"Magenta kanaal" Cyan = u"Cyaan" CyanChannel = u"Cyaan kanaal" CMYKChannels = u"CMYK-kanalen" # SplitHSLtoLayerGroup.PspScript: Lightness = u"Helderheid" LightnessChannel = u"Kanaal voor helderheid" Saturation = u"Verzadiging" SaturationChannel = u"Kanaal voor verzadiging" Hue = u"Kleurtoon" HueChannel = u"Kanaal voor kleurtoon" HSLChannels = u"HSL-kanalen" # SplitRGBtoLayerGroup.PspScript: Blue = u"Blauw" BlueChannel = u"Blauw kanaal" Green = u"Groen" GreenChannel = u"Groen kanaal" Red = u"Rood" RedChannel = u"Rood kanaal" RGBChannels = u"RGB-kanalen" # JascUtils.py, PSPUtils.py SelectionLayer = u"Selectie tot laag gemaakt via script" Pattern = u"Patroon" Inline = u"Inline" Gradient = u"Verloop" Linear = u"Lineair" Radial = u"Radiaal" Rectangular = u"Rechthoekig" Sunburst = u"Zonnestraal" Solid = u"Effen" Null = u"Nul" Art = u"Illustratie" RequiresOpenImage = u"Dit script vereist een geopende afbeelding." # End Translatable Strings